<?php


namespace app\common\exception;

class RuntimeException extends \RuntimeException
{
    public $http_code = 400;
    public $msg = '操作失败，请稍后再试！';
    public $error_code = -1; #-1 正常错误 #-2 返回后前台需要删除登陆态
    public $data = [];

    public function __construct(array $params = [])
    {
        if (array_key_exists('msg', $params)) {
            $this->msg = $params['msg'];
        }
        if (array_key_exists('data', $params)) {
            $this->data = $params['data'];
        }
        if (array_key_exists('code', $params)) {
            $this->error_code = $params['code'];
        }
        if (array_key_exists('http_code', $params)) {
            $this->http_code = $params['http_code'];
        }
    }
}